package models

import (
	"time"
)

// OrderStats 订单统计表
type OrderStats struct {
	Id            int64     `gorm:"column:id;type:bigint(20);primary_key;AUTO_INCREMENT;comment:统计记录ID" json:"id"`
	StatType      string    `gorm:"column:stat_type;type:varchar(20);comment:统计类型：daily/weekly/monthly;NOT NULL" json:"stat_type"`
	StatDate      time.Time `gorm:"column:stat_date;type:date;comment:统计日期（每日统计为当天日期，周/月统计取周期的最后一天）;NOT NULL" json:"stat_date"`
	Status1Count  int       `gorm:"column:status_1_count;type:int(11);default:0;comment:制作中数量;NOT NULL" json:"status_1_count"`
	Status1Amount float64   `gorm:"column:status_1_amount;type:decimal(12,2);default:0.00;comment:制作中金额;NOT NULL" json:"status_1_amount"`
	Status2Count  int       `gorm:"column:status_2_count;type:int(11);default:0;comment:物流中数量;NOT NULL" json:"status_2_count"`
	Status2Amount float64   `gorm:"column:status_2_amount;type:decimal(12,2);default:0.00;comment:物流中金额;NOT NULL" json:"status_2_amount"`
	Status3Count  int       `gorm:"column:status_3_count;type:int(11);default:0;comment:已完成数量;NOT NULL" json:"status_3_count"`
	Status3Amount float64   `gorm:"column:status_3_amount;type:decimal(12,2);default:0.00;comment:已完成金额;NOT NULL" json:"status_3_amount"`
	Status4Count  int       `gorm:"column:status_4_count;type:int(11);default:0;comment:已取消数量;NOT NULL" json:"status_4_count"`
	Status4Amount float64   `gorm:"column:status_4_amount;type:decimal(12,2);default:0.00;comment:已取消金额;NOT NULL" json:"status_4_amount"`
	TotalCount    int       `gorm:"column:total_count;type:int(11);default:0;comment:订单总数;NOT NULL" json:"total_count"`
	TotalAmount   float64   `gorm:"column:total_amount;type:decimal(12,2);default:0.00;comment:订单总金额;NOT NULL" json:"total_amount"`
	CreatedTime   time.Time `gorm:"column:created_time;type:timestamp;default:CURRENT_TIMESTAMP;comment:生成时间;NOT NULL" json:"created_time"`
	UpdatedTime   time.Time `gorm:"column:updated_time;type:timestamp;default:CURRENT_TIMESTAMP;comment:更新时间;NOT NULL" json:"updated_time"`
}

func (m *OrderStats) TableName() string {
	return "order_stats"
}
